home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / src / lib / H / commands / copy.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  2.7 KB  |  86 lines

  1. /*
  2.  * copy.h --
  3.  *     Definitions for using the POSTGRES copy command.
  4.  *    This isn't in h/ since it isn't called by other POSTGRES routines.
  5.  *
  6.  * Identification:
  7.  *    $Header: /private/postgres/src/lib/H/commands/RCS/copy.h,v 1.4 1990/08/17 08:52:25 cimarron Exp $
  8.  */
  9.  
  10. #ifndef CopyIncluded
  11. #define    CopyIncluded    1
  12.  
  13. #include "tmp/postgres.h"
  14.  
  15. /*
  16.  *    Copy domain
  17.  *
  18.  *------------------------------------------------------------------
  19.  * Arguments to createdomains():
  20.  *    DOMNAME            DOMTYPE            DOMDELIM
  21.  *------------------------------------------------------------------
  22.  *    attribute name        attribute type        no 
  23.  *    attribute name         "text" or NULL        optional
  24.  *    attribute name         "char[N]"        no
  25.  *    non-attribute (dummy)    ?            optional **
  26.  *    string            -1            no
  27.  *
  28.  *------------------------------------------------------------------
  29.  * As stored:
  30.  *    TYPE                DELIM?
  31.  *------------------------------------------------------------------
  32.  *    relation attribute, binary    no
  33.  *    relation attribute, text    yes
  34.  *        domlen == -1
  35.  *    relation attribute, char[N]    no
  36.  *        domlen > 0
  37.  *    dummy domain            yes **
  38.  *    string                no
  39.  *
  40.  *    ** iff domlen == -1
  41.  */
  42. typedef struct DomainData {
  43.     int    domnum;
  44.     int    attnum;        /* 0 for dummy/string */
  45.     int    domlen;        /* length in bytes of domain type/string */
  46.     short    domtype;    /* flags for domain treatment */
  47.     char     delim;         /* field delimiting character */
  48.     char    *string;    /* string value (if any) */
  49.     OID     typoutput;    /* typoutput proc to use for text write */
  50.     OID    typinput;    /* typinput proc to use for text read */
  51. } DomainData;
  52.  
  53. typedef DomainData    *Domain;
  54.  
  55. /* The only two functions the outside world should see: */
  56. extern Domain      createdomains();
  57. extern        copyrel();
  58.  
  59. /* Constants to indicate various facts to createdomains() */
  60. #define    NO_DELIM    ((char) -1)
  61. #define    STRING_TYPE    ((char *) -1)
  62.  
  63. /* Flags for the domtype field of a Domain */
  64. #define    C_NONULLS    (0x01)
  65. #define    C_DELIMITED    (0x02)
  66. #define    C_EXTERNAL    (0x04)
  67. #define    C_STRING    (0x08)
  68. #define    C_DUMMY        (0x10)
  69. #define    C_ATTRIBUTE    (0x20)
  70.  
  71. #define    DomainSetNoNulls(DOMAIN)    (DOMAIN)->domtype |= C_NONULLS
  72. #define    DomainSetDelimited(DOMAIN)    (DOMAIN)->domtype |= C_DELIMITED
  73. #define    DomainSetExternal(DOMAIN)    (DOMAIN)->domtype |= C_EXTERNAL
  74. #define    DomainSetString(DOMAIN)        (DOMAIN)->domtype |= C_STRING
  75. #define    DomainSetDummy(DOMAIN)        (DOMAIN)->domtype |= C_DUMMY
  76. #define    DomainSetAttribute(DOMAIN)    (DOMAIN)->domtype |= C_ATTRIBUTE
  77.  
  78. #define    DomainIsNoNulls(DOMAIN)        ((DOMAIN)->domtype & C_NONULLS)
  79. #define    DomainIsDelimited(DOMAIN)    ((DOMAIN)->domtype & C_DELIMITED)
  80. #define    DomainIsExternal(DOMAIN)    ((DOMAIN)->domtype & C_EXTERNAL)
  81. #define    DomainIsString(DOMAIN)        ((DOMAIN)->domtype & C_STRING)
  82. #define    DomainIsDummy(DOMAIN)        ((DOMAIN)->domtype & C_DUMMY)
  83. #define    DomainIsAttribute(DOMAIN)    ((DOMAIN)->domtype & C_ATTRIBUTE)
  84.  
  85. #endif    /* !CopyIncluded */
  86.